﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.UC.下单MTO.Service;
using DXApplicationTangche.UC.抖音出入库.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.抖音出入库
{
    public partial class Form抖音修改下单数量 : DevExpress.XtraEditors.XtraForm
    {
        private DouyinOrderRequestDTO douyinOrderRequestDTO { get; set; }
       
        public Form抖音修改下单数量(DouyinOrderRequestDTO douyinOrderRequestDTO)
        {
            InitializeComponent();
            this.douyinOrderRequestDTO = douyinOrderRequestDTO;
        }

        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            
            if (String.IsNullOrEmpty(this.textBox需求数量.Text))
            {
                MessageBox.Show("请补充数量");
                return;
            }
            if (this.douyinOrderRequestDTO.quantity> Convert.ToInt32(this.textBox需求数量.Text.ToString()))
            {
                MessageBox.Show("修改实际下单数量不可小于计划下单数量");
                return;
            }
            try
            {
                this.douyinOrderRequestDTO.actualOrderQuantity = Convert.ToInt32(this.textBox需求数量.Text.ToString());
            }
            catch { }
            this.Close();
        }

        private void textBox需求数量_Validating(object sender, CancelEventArgs e)
        {
            if (!FunctionHelper.Is大于0(this.textBox需求数量.Text.Trim()))
            {
                MessageBox.Show("需求数量必须大于0！");
                this.ActiveControl = this.textBox需求数量;
                return;
            }
        }

    }
}
